<template>
	<div>
		<el-input v-model="input" placeholder="请输入内容"></el-input>
		<el-button @click="onClick">默认按钮</el-button>
		<p>{{showInput}}</p>
	</div>
</template>

<script>
	export default {
		name: 'test1',
		data() {
			return {
				showInput: '',
				input: ''

			}
		},
		watch: {

		},
		mounted() {

		},
		methods: {
			onClick() {
				this.showInput = this.formatName(this.input)
			},
			showUrl(url) {
				this.urlShow = url;
				this.centerDialogVisible = true;
			},
			//加密方法
			formatName(name) {
				let newStr;
				if (name.length > 2) {
					let char = '';
					for (let i = 0, len = name.length - 7; i < len; i++) {
						char += '*';
					}
					newStr = name.substr(0, 3) + char + name.substr(-4, 4);
				} else {
					newStr = name;
				}
				return newStr;
			},
		}
	}
</script>

<style>
</style>
